<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>modify</title>
    <link rel="icon" href="favicon.ico" type="image/x-icon">
    <link href="/static/css/reset.css" rel="stylesheet">
    <!-- Bootstrap3.3.5 CSS -->
    <link href="/static/css/bootstrap.min.css" rel="stylesheet">
    <link href="/static/css/login.css" rel="stylesheet">
    <link href="/static/css/queryResult.css" rel="stylesheet">
    <link href="/static/css/addEdu.css" rel="stylesheet">
</head>
<body>
<div class="container">
    <div class="queryResule">
        <h2>修改高等教育学历信息</h2>
        <div class="back">
          {{if eq .CurrentUser.IsAdmin "T"}}
              <a href="/addEduInfo">添加信息</a>
          {{end}}
            <a href="/index">返回首页</a>
        </div>
        <form action="/modify" method="post" name="modifyForm">
        <div class="top">
              <div class="left">
                  <p>
                      <span>姓名：</span>
                      <span>
                        <input type="text" name="name" value="{{.Edu.Name}}" class="input_text" tabindex="1" onfocus="if(this.placeholder=='姓名'){this.placeholder='';}this.className ='input_text input_text_focus'" onblur="if(this.value==''){this.placeholder='姓名';this.className ='input_text'}" accesskey="n" type="text" placeholder="姓名" size="25" autocomplete="off">
                      </span>
                  </p>
                  <p>
                      <span>籍贯：</span>
                      <span>
                        <input type="text" name="place" value="{{.Edu.Place}}" class="input_text" tabindex="1" onfocus="if(this.placeholder=='籍贯'){this.placeholder='';}this.className ='input_text input_text_focus'" onblur="if(this.value==''){this.placeholder='籍贯';this.className ='input_text'}" accesskey="n" type="text" placeholder="籍贯" size="25" autocomplete="off">
                      </span>
                  </p>
                  <p>
                      <span>民族：</span>
                      <span>
                        <input type="text" name="nation" value="{{.Edu.Nation}}" class="input_text" tabindex="1" onfocus="if(this.placeholder=='民族'){this.placeholder='';}this.className ='input_text input_text_focus'" onblur="if(this.value==''){this.placeholder='民族';this.className ='input_text'}" accesskey="n" type="text" placeholder="民族" size="25" autocomplete="off">
                      </span>
                  </p>
                  <p>
                      <span>入学日期：</span>
                      <span>
                        <input type="text" name="enrollDate" value="{{.Edu.EnrollDate}}"class="input_text" tabindex="1" onfocus="if(this.placeholder=='入学日期'){this.placeholder='';}this.className ='input_text input_text_focus'" onblur="if(this.value==''){this.placeholder='入学日期';this.className ='input_text'}" accesskey="n" type="text" placeholder="入学日期" size="25" autocomplete="off">
                      </span>
                  </p>
                  <p>
                      <span>学校名称：</span>
                      <span>
                        <input type="text" name="schoolName" value="{{.Edu.SchoolName}}" class="input_text" tabindex="1" onfocus="if(this.placeholder=='学校名称'){this.placeholder='';}this.className ='input_text input_text_focus'" onblur="if(this.value==''){this.placeholder='学校名称';this.className ='input_text'}" accesskey="n" type="text" placeholder="学校名称" size="25" autocomplete="off">
                      </span>
                  </p>
                  <p>
                      <span>学历类别：</span>
                      <span>
                        <input type="text" name="quaType" value="{{.Edu.QuaType}}" class="input_text" tabindex="1" onfocus="if(this.placeholder=='学历类别'){this.placeholder='';}this.className ='input_text input_text_focus'" onblur="if(this.value==''){this.placeholder='学历类别';this.className ='input_text'}" accesskey="n" type="text" placeholder="学历类别" size="25" autocomplete="off">
                      </span>
                  </p>
                  <p>
                      <span>层次：</span>
                      <span>
                        <input type="text" name="level" value="{{.Edu.Level}}" class="input_text" tabindex="1" onfocus="if(this.placeholder=='层次'){this.placeholder='';}this.className ='input_text input_text_focus'" onblur="if(this.value==''){this.placeholder='层次';this.className ='input_text'}" accesskey="n" type="text" placeholder="层次" size="25" autocomplete="off">
                      </span>
                  </p>
                  <p>
                      <span>毕(结)业：</span>
                      <span>
                        <input type="text" name="graduation" value="{{.Edu.Graduation}}" class="input_text" tabindex="1" onfocus="if(this.placeholder=='毕业/结业'){this.placeholder='';}this.className ='input_text input_text_focus'" onblur="if(this.value==''){this.placeholder='毕业/结业';this.className ='input_text'}" accesskey="n" type="text" placeholder="毕业/结业" size="25" autocomplete="off">
                      </span>
                  </p>
              </div>
              <div class="right">
                  <p>
                      <span>性别：</span>
                      <span>
                        <input type="text" name="gender" value="{{.Edu.Gender}}" class="input_text" tabindex="1" onfocus="if(this.placeholder=='性别'){this.placeholder='';}this.className ='input_text input_text_focus'" onblur="if(this.value==''){this.placeholder='性别';this.className ='input_text'}" accesskey="n" type="text" placeholder="性别" size="25" autocomplete="off">
                      </span>
                  </p>
                  <p>
                      <span>出生日期：</span>
                      <span>
                        <input type="text" name="birthDay" value="{{.Edu.BirthDay}}" class="input_text" tabindex="1" onfocus="if(this.placeholder=='出生日期'){this.placeholder='';}this.className ='input_text input_text_focus'" onblur="if(this.value==''){this.placeholder='出生日期';this.className ='input_text'}" accesskey="n" type="text" placeholder="出生日期" size="25" autocomplete="off">
                      </span>
                  </p>
                  <p>
                      <span>身份证号：</span>
                      <span>
                        <input type="text" name="entityID" value="{{.Edu.EntityID}}" class="input_text" tabindex="1" onfocus="if(this.placeholder=='身份证号'){this.placeholder='';}this.className ='input_text input_text_focus'" onblur="if(this.value==''){this.placeholder='身份证号';this.className ='input_text'}" accesskey="n" type="text" placeholder="身份证号" size="25" autocomplete="off">
                      </span>
                  </p>
                  <p>
                      <span>毕(结)业日期：</span>
                      <span>
                        <input type="text" name="graduationDate" value="{{.Edu.GraduationDate}}" class="input_text" tabindex="1" onfocus="if(this.placeholder=='毕(结)业日期'){this.placeholder='';}this.className ='input_text input_text_focus'" onblur="if(this.value==''){this.placeholder='毕(结)业日期';this.className ='input_text'}" accesskey="n" type="text" placeholder="毕(结)业日期" size="25" autocomplete="off">
                      </span>
                  </p>
                  <p>
                      <span>专业：</span>
                      <span>
                        <input type="text" name="major" value="{{.Edu.Major}}" class="input_text" tabindex="1" onfocus="if(this.placeholder=='专业'){this.placeholder='';}this.className ='input_text input_text_focus'" onblur="if(this.value==''){this.placeholder='专业';this.className ='input_text'}" accesskey="n" type="text" placeholder="专业" size="25" autocomplete="off">
                      </span>
                  </p>
                  <p>
                      <span>学习形式：</span>
                      <span>
                        <input type="text" name="mode" value="{{.Edu.Mode}}" class="input_text" tabindex="1" onfocus="if(this.placeholder=='学习形式'){this.placeholder='';}this.className ='input_text input_text_focus'" onblur="if(this.value==''){this.placeholder='学习形式';this.className ='input_text'}" accesskey="n" type="text" placeholder="学习形式" size="25" autocomplete="off" placeholder="">
                      </span>
                  </p>
                  <p>
                      <span>学制：</span>
                      <span>
                        <input type="text" name="length" value="{{.Edu.Length}}" class="input_text" tabindex="1" onfocus="if(this.placeholder=='学制'){this.placeholder='';}this.className ='input_text input_text_focus'" onblur="if(this.value==''){this.placeholder='学制';this.className ='input_text'}" accesskey="n" type="text" placeholder="学制" size="25" autocomplete="off">
                      </span>
                  </p>
                  <p>
                      <span>证书编号：</span>
                      <span>
                        <input type="text" name="certNo" value="{{.Edu.CertNo}}" class="input_text" tabindex="1" onfocus="if(this.placeholder=='证书编号'){this.placeholder='';}this.className ='input_text input_text_focus'" onblur="if(this.value==''){this.placeholder='证书编号';this.className ='input_text'}" accesskey="n" type="text" placeholder="证书编号" size="25" autocomplete="off">
                      </span>
                  </p>
              </div>

            <div class="headImg">
                <div class="uploadImg">
                    <input type="file" name="" value="上传照片" id="file">
                    +
                    <!-- <img src="./images/head.jpg" alt=""> -->
                    <img src="{{.Edu.Photo}}" alt="">
                </div>
                <p>上传照片(120*160px)</p>
            </div>
        </div>
        <input type="hidden" name="photo" id="photo" value="{{.Edu.Photo}}"/>
        <button type="button" name="button" class="btn">修改学历信息</button>
        </form>
    </div>
    <!-- data-backdrop="false"去除遮罩层  -->
    <div class="modal fade bd-example-modal-sm"  id="myModal" role="dialog" data-backdrop="false"  aria-hidden="true">
        <div class="modal-dialog modal-sm">
            <div class="modal-content">
                <p class="text-center mb-0" style="height:42px;line-height:42px;margin:0;">
                    <i class="fa fa-check-circle text-success mr-1" aria-hidden="true"></i>
                    请输入学历所必需的相关信息
                </p>
            </div>
        </div>
    </div>

</div>
</body>
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/js/bootstrap.min.js"></script>
<script type="text/javascript">
    $(function() {
        // 上传图片
        $('#file').unbind('change').bind('change',function() {
            event.stopPropagation();
            uploadFile('img');
            return;
        });
        // 头像图片
        var artImg;
        function uploadFile(type) {
            event.stopPropagation();
            let formData = new FormData();
            if( type == "img"){
                formData.append('file', $('#file')[0].files[0]);
            }
            $.ajax({
                url: '/upload',
                type: 'POST',
                cache: false,
                data: formData,
                processData: false,
                dataType: "json",
                contentType: false
            }).done(function (res) {
                if (res.error == "0") {
                    if( type == "img"){
                        $('.uploadImg img').attr('src', res.result.path);
                        $('#photo').val(res.result.path)
                        return artImg = res.result.path;
                    }
                } else {
                    alert("上传失败！" + res.result.msg)
                }
            }).fail(function (res) { });
        }

        var inputs = $('input[type="text"]');
        // 提交按钮
        $('.btn').click(function() {
            // 如果为空 报错提示
            for (var i = 0; i < inputs.length; i++) {
                if (!($(inputs[i]).val())) {
                    $(inputs[i]).addClass('redColor');
                    $('#myModal').modal('show');
                    setTimeout(function(){
                        $("#myModal").modal("hide");
                    },2000);
                    return;
                }
            }

            // 成功后提交数据
            $("form[name='modifyForm']").submit()
        })
    })
</script>
</html>
